package com.taxigang.client.uibinder;

import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.TextArea;
import com.google.gwt.user.client.ui.Widget;
import com.taxigang.client.micro.TaxiGangCreator;
import com.taxigang.client.ui.map.MapView.PanelType;

public class Feedback extends TaxiGangPanel {

	private static FeedbackUiBinder uiBinder = GWT
			.create(FeedbackUiBinder.class);

	interface FeedbackUiBinder extends UiBinder<Widget, Feedback> {
	}

	public Feedback() {
		initWidget(uiBinder.createAndBindUi(this));
		bind();
	}


	@UiField Button sendMessageButton;
	@UiField Button cancelButton;
	@UiField TextArea messageTextArea;


	private void bind(){
		sendMessageButton.setText(TaxiGangCreator.taxiGangConstants.sendMessage());
		cancelButton.setText(TaxiGangCreator.taxiGangConstants.cancel());

		sendMessageButton.addClickHandler(new ClickHandler() {
			
			@Override
			public void onClick(ClickEvent event) {
				Window.alert("feedback - in dev");
//				FeedbackInfo info = new FeedbackInfo(0,messageTextArea.getText(),new Date(), Session.getInstance().getLoginInfo().getId());
//				TaxiGangHandler.getInstance().crudAdmin(Crud.CREATE , info);
//				taxiGangRoute.show(PanelType.SEARCH);
			}
		});

		cancelButton.addClickHandler(new ClickHandler() {
			
			@Override
			public void onClick(ClickEvent event) {
				// TODO store nickname
				taxiGangRoute.show(PanelType.SEARCH);
			}
		});

	}

}
